package com.itheima.sh;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//@SpringBootApplication
//@EnableDiscoveryClient  // 补注解 11/27 （讲义漏掉了）
//@EnableFeignClients(basePackages = "com.itheima.sh.clients")    //第一步，识别该注解 feign搬家，只为最佳实践
//@EnableCircuitBreaker   //开启熔断器  准确说，有了熔断器这个开关
@SpringCloudApplication //组合注解 包含上面的@SpringBootApplication/@EnableDiscoveryClient/@EnableCircuitBreaker
public class ConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
        System.out.println("=== comsumer_demo 启动 ===");
    }

    // 注册RestTemplate的对象到Spring的容器中
    @Bean
    @LoadBalanced   //开启负载均衡
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

}
